package com.niit.mapper;

import com.niit.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("SELECT * FROM user WHERE userId = #{userId}")
    User getUserById(String userId);

    @Insert("INSERT INTO user (userId, userPwd, userHobbies) VALUES (#{userId}, #{userPwd}, #{userHobbies})")
    void insertUser(User user);

    @Update("UPDATE user SET userPwd = #{userPwd}, userHobbies = #{userHobbies} WHERE userId = #{userId}")
    void updateUser(User user);

    @Delete("DELETE FROM user WHERE userId = #{userId}")
    void deleteUser(String userId);

    @Select("SELECT * FROM user")
    List<User> getAllUsers();
}